jQuery(document)
		.ready(function() {
			

	var rootUrl ='http://localhost:8080/regrest/das/servers';//'http://www.dasregistry.org/das/servers';//'http://localhost:8080/regrest/das/servers';
        jQuery.getJSON(rootUrl, function(serversObject) {
							//if(servers.source.length==undefined || servers.source.length==0){
							//	$("#results").html('No results');
							
							//	return text="No sources returned for this query";
							//}
        var st=JSON.stringify(serversObject);
        var text="";
        text += '<div id=\"table\"><table id=\"list\"class=\"dastable\">';
        text +='<tr class="row0"><td>Server URL</td><td>Server Description</td><td>Number Of Sources Registered for Server</td><td>Server Controlled</td></tr>';
        for(var i=0;i<serversObject.server.length;i++){
            var uri='';
            if(serversObject.server[i].uri!=undefined)uri=serversObject.server[i].uri;
            var description='';
            if(serversObject.server[i].description!=undefined)description=serversObject.server[i].description;
            var numberOfSources='';
            if(serversObject.server[i].numberOfSources!=undefined)numberOfSources=serversObject.server[i].numberOfSources;
            var controlled='';
            if(serversObject.server[i].serverControlled!=undefined)controlled=serversObject.server[i].serverControlled;
        
        var rowClass='row0';
        if (i % 2 == 0) {
				rowClass = 'row1';
			} else {
				rowClass = 'row0';
			}
        text+='<tr class="'+rowClass+'">'+'<td>'+uri+'</td>'+'<td>'+description+'</td>'+'<td>'+'<a href="listSources.jsp?serverUrl='+uri+'">'+numberOfSources+'</a>'+'</td>'+'<td>'+controlled+'</td>'+'</tr>';
        }
        text += '</table></div>';
        //text+=st;
	$("#results").html(text);
        });


			
			
			
			
			
});